package com.twu.biblioteca;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: luisarmando
 * Date: 1/25/13
 * Time: 11:16 AM
 * To change this template use File | Settings | File Templates.
 */
public class Movie {
    private boolean isReserved;
    private String title;
    private int rating;
    private int year;
    private String director;

    public Movie(String title) {
        this.title = title;
        this.isReserved = false;
    }

    public Movie(String title, int year, String director) {
        this.title = title;
        this.year = year;
        this.director = director;
        this.rating = 0;
    }

    public Movie(String title, int year, String director, int rating) {
        this.title = title;
        this.year = year;
        this.director = director;
        this.rating = 0;
        setRating(rating);
    }

    public boolean isReserved() {
        return isReserved;
    }

    public void setReserved(boolean reserved) {
        isReserved = reserved;
    }

    public String getTitle() {
        return title;
    }

    public int getRating() {
        return rating;
    }

    public boolean setRating(int rating) {
        if (rating>0 && rating<=10){
            this.rating = rating;
            return true;
        } else {
            return false;
        }
    }

    public int getYear() {
        return year;
    }

    public String getDirector() {
        return director;
    }

    @Override
    public String toString() {
        String ret = getTitle()+"\t"+Integer.toString(getYear())+"\t"+getDirector()+"\t";
        if (getRating()>0)
            return ret+Integer.toString(getRating());
        else
            return ret+"N/A";
    }

    public static List<Movie> getMovies(){
        List<Movie> movies = new ArrayList<Movie>();
        movies.add(new Movie("Sholay", 1975, "Ramesh Sippy"));
        movies.add(new Movie("Matrix", 1999, "Someone"));
        movies.add(new Movie("Fight Club", 1999, "Someone"));
        movies.add(new Movie("Movie4", 1999, "Someone"));
        movies.add(new Movie("Movie5", 1999, "Someone"));
        movies.add(new Movie("Movie6", 1999, "Someone"));
        movies.add(new Movie("Movie7", 1999, "Someone"));
        movies.add(new Movie("Movie8", 1999, "Someone"));
        movies.add(new Movie("Movie9", 1999, "Someone"));
        movies.add(new Movie("Movie10", 1999, "Someone"));
        movies.add(new Movie("Movie11", 1999, "Someone"));
        movies.add(new Movie("Movie12", 1999, "Someone"));
        movies.add(new Movie("Movie13", 1999, "Someone"));
        movies.add(new Movie("Movie14", 1999, "Someone"));
        movies.add(new Movie("Movie15", 1999, "Someone"));
        return movies;
    }
}
